import Result from "@/model/Result";
import axios from "@/axios/api";
import type PageQuery from "@/model/PageQuery";
import type Page from "@/model/Page";
import type Video from "@/model/Video";

export default class VideoApi {

    static get = async (id: number) => {
        return await axios.get<Result<Video>>(`/api/v1/video/${id}`)
            .then(resp => resp.data)
    }

    static remove = async (id: number) => {
        return await axios.delete<Result<Video>>(`/api/v1/video/${id}`)
            .then(resp => resp.data)
    }


    static page = async (query: PageQuery) => {
        return await axios.post<Result<Page<Video>>>(`/api/v1/video/page`, query)
            .then(resp => resp.data)
    }
}